﻿<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
   xmlns:localcontrols="clr-namespace:SL8.SL.Controls"
   xmlns:localexts="clr-namespace:SL8.SL.Extensions"  
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <Style TargetType="Button" x:Key="DialogChromeButton">
        <Setter Property="FontFamily" Value="Webdings"></Setter>
        <Setter Property="Foreground" Value="White"></Setter>
        <Setter Property="Margin" Value="0"></Setter>
        <Setter Property="Padding" Value="0"></Setter>
        <Setter Property="FontWeight" Value="Bold"></Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">
                    <Grid x:Name="Root">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0:0:0.25"/>
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="Normal"/>
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" To="0.5" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="border" d:IsOptimized="True"/>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Pressed"/>
                                <VisualState x:Name="Disabled"/>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Border x:Name="border" BorderThickness="1" Margin="0" CornerRadius="2" Background="{TemplateBinding Background}" Opacity="0"/>
                        <ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center"/>
                        <!--<Border x:Name="DragResizeButton" Width="16" Height="16" HorizontalAlignment="Right" Background="Red"  VerticalAlignment="Bottom"></Border>-->
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style TargetType="localcontrols:AppChromeControl">
        <Setter Property="BorderBrush" Value="Black"></Setter>
        <Setter Property="Background" Value="#FF2B7EB2"></Setter>
        <Setter Property="Foreground" Value="White"></Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="localcontrols:AppChromeControl">
                    <Grid x:Name="Root" localexts:MainWindowDragMoveService.IsDragMove="True" Background="{TemplateBinding Background}">
                        <localcontrols:TiledImage HorizontalAlignment="Stretch" VerticalAlignment="Stretch" SourceUri="{TemplateBinding BackgroundSourceUri}" />
                        <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1"   >
                            <Border BorderBrush="#66FFFFFF" BorderThickness="1">
                                <Grid>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="30" />
                                        <RowDefinition Height="*" />
                                    </Grid.RowDefinitions>
                                    <Grid Grid.Row="0">
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="Auto"/>
                                            <ColumnDefinition Width="Auto"/>
                                            <ColumnDefinition Width="*"/>
                                            <ColumnDefinition Width="Auto"/>
                                        </Grid.ColumnDefinitions>
                                        <Border BorderThickness="0" Grid.ColumnSpan="4" Margin="0">
                                            <Border.Background>
                                                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                                    <GradientStop Color="#19000000" Offset="0"/>
                                                    <GradientStop Offset="1"/>
                                                </LinearGradientBrush>
                                            </Border.Background>
                                        </Border>
                                        <Image x:Name="AppIconImage" Margin="7" Source="{TemplateBinding AppIconImageSource}" Grid.Column="0" Width="16" Height="16"/>
                                        <TextBlock x:Name="AppTitleTextBlock" FontFamily="Arial,SimSun" FontSize="14" Text="{TemplateBinding Title}" Grid.ColumnSpan="3" Grid.Column="1" Foreground="{TemplateBinding Foreground}" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="0,0,0,0"/>
                                        <Border Grid.Column="3" Width="100" Height="20" VerticalAlignment="Top" HorizontalAlignment="Right" Margin="0,0,6,0" BorderThickness="1,0,1,1" BorderBrush="#33000000" CornerRadius="0,0,4,4">
                                            <Border.Background>
                                                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                                    <GradientStop Color="#19FFFFFF"/>
                                                    <GradientStop Color="Transparent" Offset="1"/>
                                                    <GradientStop Color="#19FFFFFF" Offset="0.4"/>
                                                </LinearGradientBrush>
                                            </Border.Background>
                                            <Border BorderThickness="1,0,1,1" CornerRadius="0,0,3,3">
                                                <Border.BorderBrush>
                                                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                                        <GradientStop Color="#33FFFFFF" Offset="0"/>
                                                        <GradientStop Color="#0CFFFFFF" Offset="1"/>
                                                    </LinearGradientBrush>
                                                </Border.BorderBrush>
                                                <Grid>
                                                    <Grid.ColumnDefinitions>
                                                        <ColumnDefinition Width="30*"/>
                                                        <ColumnDefinition Width="Auto"/>
                                                        <ColumnDefinition Width="30*"/>
                                                        <ColumnDefinition Width="Auto"/>
                                                        <ColumnDefinition Width="40*"/>
                                                    </Grid.ColumnDefinitions>
                                                    <Button x:Name="MinimizeButton" Grid.Column="0" Content="0" Style="{StaticResource DialogChromeButton}" Background="White"/>
                                                    <Border Grid.Column="1" BorderThickness="1,0" Width="3">
                                                        <Border.BorderBrush>
                                                            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                                                <GradientStop Color="#33FFFFFF" Offset="0"/>
                                                                <GradientStop Color="Transparent" Offset="1"/>
                                                            </LinearGradientBrush>
                                                        </Border.BorderBrush>
                                                        <Border.Background>
                                                            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                                                <GradientStop Color="#33000000" Offset="0"/>
                                                                <GradientStop Offset="1"/>
                                                            </LinearGradientBrush>
                                                        </Border.Background>
                                                    </Border>
                                                    <Button x:Name="RestoreButton" Grid.Column="2" Style="{StaticResource DialogChromeButton}" Content="1" Background="White"/>
                                                    <Border Grid.Column="3" BorderThickness="1,0" Width="3">
                                                        <Border.BorderBrush>
                                                            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                                                <GradientStop Color="#33FFFFFF" Offset="0"/>
                                                                <GradientStop Color="Transparent" Offset="1"/>
                                                            </LinearGradientBrush>
                                                        </Border.BorderBrush>
                                                        <Border.Background>
                                                            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                                                <GradientStop Color="#33000000" Offset="0"/>
                                                                <GradientStop Offset="1"/>
                                                            </LinearGradientBrush>
                                                        </Border.Background>
                                                    </Border>
                                                    <Button x:Name="CloseButton" Grid.Column="4" Style="{StaticResource DialogChromeButton}" Content="r" Background="#FF7E0000"/>
                                                </Grid>
                                            </Border>
                                        </Border>
                                    </Grid>
                                    <ContentPresenter Grid.Row="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>

                                </Grid>
                            </Border>
                        </Border>
                        <Border x:Name="DragResizeBorder"  Cursor="SizeNWSE" Width="12" Height="12" Margin="0,0,3,3" HorizontalAlignment="Right" VerticalAlignment="Bottom">
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition/>
                                    <ColumnDefinition/>
                                    <ColumnDefinition/>
                                    <ColumnDefinition/>
                                </Grid.ColumnDefinitions>
                                <Grid.RowDefinitions>
                                    <RowDefinition/>
                                    <RowDefinition/>
                                    <RowDefinition/>
                                    <RowDefinition/>
                                </Grid.RowDefinitions>
                                <Rectangle Fill="#01FFFFFF" Opacity="0.001" Grid.RowSpan="3" Grid.ColumnSpan="3"/>
                                
                                <Rectangle Fill="#77FFFFFF" Grid.Row="0" Grid.Column="3" Width="2" Height="2" />
                                
                                <Rectangle Fill="#77FFFFFF" Grid.Row="1" Grid.Column="2" Width="2" Height="2"/>
                                <Rectangle Fill="#77FFFFFF" Grid.Row="1" Grid.Column="3" Width="2" Height="2"/>
                                
                                <Rectangle Fill="#77FFFFFF" Grid.Row="2" Grid.Column="1" Width="2" Height="2"/>
                                <Rectangle Fill="#77FFFFFF" Grid.Row="2" Grid.Column="2" Width="2" Height="2"/>
                                <Rectangle Fill="#77FFFFFF" Grid.Row="2" Grid.Column="3" Width="2" Height="2"/>
                                
                                <Rectangle Fill="#77FFFFFF" Grid.Row="3" Grid.Column="0" Width="2" Height="2"/>
                                <Rectangle Fill="#77FFFFFF" Grid.Row="3" Grid.Column="1" Width="2" Height="2"/>
                                <Rectangle Fill="#77FFFFFF" Grid.Row="3" Grid.Column="2" Width="2" Height="2"/>
                                <Rectangle Fill="#77FFFFFF" Grid.Row="3" Grid.Column="3" Width="2" Height="2"/>
                            </Grid>
                        </Border>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>
